<template>
	<view class="mainbody">
		<!-- <button type="default" open-type="contact">asda</button> -->
		<view class="mainbox" v-if="order_info.status !== undefined">
			<view class="topitem" :class="order_info.status == 1 ? 'status1' : (order_info.status == 2 ? 'status2' : 'status3')">
				{{order_info.status == 1 ? '转让中' : (order_info.status == 2 ? '转让成功' : '转让失败')}}
			</view>
			<view class="topitem">
				￥{{order_info.amount}}
			</view>
			<view class="contentline" style="margin-top: 20px;">
				<view class="title">
					转让单号
				</view>
				<view class="content">
					{{order_info.platform_order_no}}
				</view>
			</view>
			<view class="contentline">
				<view class="title"> 
					转让方式
				</view>
				<view class="content">
					{{order_info.way == 2002 ? '银行卡' : (order_info.way == 2003 ? '微信' : '')}}
				</view>
			</view>
			<view class="contentline">
				<view class="title">
					申请时间
				</view>
				<view class="content"> 
					{{order_info.add_time}}
				</view>
			</view>
			<view class="contentline" v-if="order_info.status ==2">
				<view class="title">
					到账时间
				</view>
				<view class="content">
					{{order_info.put_time}}
				</view>
			</view>
			<view class="contentline" v-if="order_info.status == 3">
				<view class="title">
					转让备注
				</view>
				<view class="content">
					{{order_info.error_msg}}
				</view>
			</view>
			<view class="fgline">

			</view>
			<view class="contentline">
				<view class="title">
					姓名
				</view>
				<view class="content">
					{{order_info.name}}
				</view>
			</view>
			<view class="contentline" v-if="order_info.way == 2002">
				<view class="title">
					身份证
				</view>
				<view class="content">
					{{order_info.idcard_number}}
				</view>
			</view>
			<view class="contentline" v-if="order_info.way == 2002">
				<view class="title">
					银行卡
				</view>
				<view class="content">
					{{order_info.bank_number}}
				</view>
			</view>
			<view class="contentline" v-if="order_info.way == 2002">
				<view class="title">
					手机号
				</view>
				<view class="content">
					{{order_info.phone}}
				</view>
			</view>
		</view>
		<view class="bottomtips" v-if="order_info.status !== undefined">
			* 审核成功后约72小时内到账，请留意账户明细
		</view>
		<view class="ReturnBut" @tap="ReturnPage" v-if="order_info.status !== undefined">
			返回
		</view>
	</view>
</template>
<script>
	import {
		WithdrawInfo
	} from "@/api/withdraw.js";
	export default {
		data() {
			return {
				order_no: null,
				order_info: {},
			}
		},
		onLoad(option) {
			if (option.order_no == undefined) {
				uni.showModal({
					title: '错误访问',
					showCancel: false,
					success: res => {
						if (res.confirm) {
							setTimeout(() => {
								uni.navigateBack({
									delta: 1
								})
							}, 1000);
						}
					}
				});
				return;
			}
			this.order_no = option.order_no;
			this.GetWithdrawInfo();
		},
		methods: {
			GetWithdrawInfo() {
				let _this = this;
				uni.showLoading({
					title:'数据加载中',
					mask:true,
				})
				WithdrawInfo({
						order_no:_this.order_no
					}).then(res=>{
						uni.hideLoading();
					if(res.status == 200){
						_this.order_info = res.data;
					}
					//begin by zhangwen
					else{
						uni.showModal({
							title: '获取数据失败，请重试',
							showCancel:false,
							success:res=>{
								if(res.confirm){
									uni.navigateBack({
										delta:1
									})
								}
							}
						}) 
					}
					//end by zhangwen
				}).catch(err => {
					//begin by zhangwen
					uni.hideLoading();
					uni.showModal({
						title: '获取网络失败,请打开网络',
						showCancel:false,
						success:res=>{
							if(res.confirm){
								uni.navigateBack({
									delta:1
								})
							}
						}
					}) 
					//end by zhangwen
				});
			},
			ReturnPage(){
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style lang="scss">
	.mainbox {
		width: 94%;
		margin: 3% 3% 20px 3%;
		padding: 3% 3% 12% 3%;
		background-color: #fff;
		border-radius: 8px;

		.topitem {
			text-align: center;
			margin-top: 20px;
			font-size: 36rpx;
			font-weight: 700;
		}
		
		.status1{
			color: #1E9FFF;
		}
		.status2{
			color: #4cd964;
		}
		.status3{
			color: #FFB800;
		}
		.contentline {
			width: 100%;
			display: flex;
			justify-content: space-between;
			margin: 14px 0 0 0;

			.title {
				width: 30%;
			}

			.content {
				width: 70%;
				text-align: right;
			}
		}

		.fgline {
			width: 100%;
			height: 1px;
			background-color: #9a9a9a;
			margin: 25px 0;
		}
	}

	.bottomtips {
		width: 100%;
		text-align: center;
		color: #999;
	}

	.ReturnBut {
		width: 60%;
		height: 90rpx;
		line-height: 90rpx;
		margin: 80rpx 20% 40rpx 20%;
		border-radius: 12rpx;
		background-color: #007aff;
		color: #fff;
		text-align: center;

	}
</style>